package com.spring.arch.operation.tenant.model;

import com.spring.arch.common.jpa.model.AbstractLogicalModel;
import com.spring.arch.common.jpa.model.AbstractLogicalModel;
import com.spring.arch.operation.tenant.enums.EnterpriseType;
import com.spring.arch.operation.tenant.enums.LesseeStatus;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;

/**
 * 租客
 * @author Frank
 * @version 1.0.0
 * @since 2020/3/23
 */
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "tenant_lessee")
public class Lessee extends AbstractLogicalModel {
    private static final long serialVersionUID = -5319272416400334765L;

    /**
     * 公司名称（租客名称/业主）
     */
    @NotBlank
    @Size(max = 64)
    @Column(nullable = false, unique = true)
    private String name;

    /**
     * 客户类型（枚举）
     */
    @NotNull
    @Enumerated(value = EnumType.STRING)
    @Column(length = 32)
    private EnterpriseType type = EnterpriseType.LIMITED_LIABILITY;

    /**
     * 租客状态：潜在客户，租约中，历史租客
     */
    @NotNull
    @Enumerated(EnumType.STRING)
    @Column(length = 32)
    private LesseeStatus status = LesseeStatus.POTENTIAL;

    /**
     * 客户标识
     */
    @Size(max = 32)
    private String customerIdentifier;

    /**
     * 所属行业（数据字典【lesseeIndustry】）
     */
    @Size(max = 32)
    private String industry;

    /**
     * 成立时间：2020-03-23
     */
    private LocalDate foundingTime;

    /**
     * 统一社会信用代码：营业执照编号
     */
    @Size(max = 32)
    private String socialCreditCode;

    /**
     * 注册资本
     */
    @Size(max = 16)
    private String registeredCapital;

    /**
     * 法人
     */
    @Size(max = 32)
    private String legalPerson;

    /**
     * 企业电话
     */
    @Size(max = 11)
    private String telephone;

    /**
     * 企业地址
     */
    @Size(max = 128)
    private String address;

    /**
     * 通讯地址
     */
    @NotBlank
    @Size(max = 128)
    @Column(nullable = false)
    private String postalAddress;
}
